package com.zj.joke;

import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.pm.PackageManager.NameNotFoundException;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.TextView;
import com.zj.joke.R;

public class AboutActivity extends ZJActivity implements OnClickListener {
	private TextView backTv;
	private TextView versionTv;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.about);
		findViews();
		PackageManager pm = getPackageManager();
		try {
			PackageInfo pi = pm.getPackageInfo(getPackageName(), 0);
			String versionName = pi.versionName;
			if (!TextUtils.isEmpty(versionName)) {
				versionTv.setText("版本： V" + versionName);
			}
		} catch (NameNotFoundException e) {
			e.printStackTrace();
		}
	}

	private void findViews() {
		backTv = (TextView) findViewById(R.id.aboutback);
		backTv.setOnClickListener(this);
		versionTv = (TextView) findViewById(R.id.aboutVersion);
	}

	@Override
	public void onBackPressed() {
		finish();
		// overridePendingTransition(R.anim.push_top_in,
		// R.anim.push_bottom_out);
		overridePendingTransition(R.anim.activity_zoom_in,
				R.anim.activity_zoom_out);
	}

	@Override
	public void onClick(View v) {
		switch (v.getId()) {
		case R.id.aboutback:
			finish();
			overridePendingTransition(R.anim.activity_zoom_in,
					R.anim.activity_zoom_out);
			break;
		}

	}
}
